import {
  NavigationGuardNext,
  RouteLocationNormalized,
  RouteRecordRaw,
  createRouter,
  createWebHistory,
} from "vue-router";

// 配置页面路由
const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "index",
    children: [
      {
        path: "/login", // 登录页面
        name: "login",
        component: () => import("@/views/login/index.vue"),
        children: [
          {
            path: "/login",
            name: "loginIndex",
            component: () => import("@/views/login/account-panel.vue"),
          }
        ],
      },
      {
        path:"/home", // 主页面
        name:"home",
        
        component: () => import("@/views/home/index.vue"),
        children:[{
          path:"/quotes", // 主页面
          name:"quotes",
          component: () => import("@/views/quotes/index.vue"),
        }]
      }
    ],
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

router.beforeEach(
  (
    to: RouteLocationNormalized,
    from: RouteLocationNormalized,
    next: NavigationGuardNext
  ) => {
    next();
  }
);

export default router;
